/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package multiface.promonet.jpa;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author diego
 */
@Entity
@Table(name = "studi")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Studi.findAll", query = "SELECT s FROM Studi s"),
    @NamedQuery(name = "Studi.findByIdstudi", query = "SELECT s FROM Studi s WHERE s.idstudi = :idstudi"),
    @NamedQuery(name = "Studi.findByIstituto", query = "SELECT s FROM Studi s WHERE s.istituto = :istituto"),
    @NamedQuery(name = "Studi.findByTipo", query = "SELECT s FROM Studi s WHERE s.tipo = :tipo"),
    @NamedQuery(name = "Studi.findByVoto", query = "SELECT s FROM Studi s WHERE s.voto = :voto"),
    @NamedQuery(name = "Studi.findByAnno", query = "SELECT s FROM Studi s WHERE s.anno = :anno")})
public class Studi implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "idstudi")
    private Integer idstudi;
    @Basic(optional = false)
    @Column(name = "istituto")
    private String istituto;
    @Basic(optional = false)
    @Column(name = "tipo")
    private String tipo;
    @Basic(optional = false)
    @Column(name = "voto")
    private String voto;
    @Basic(optional = false)
    @Column(name = "anno")
    @Temporal(TemporalType.DATE)
    private Date anno;
    @JoinColumn(name = "utente", referencedColumnName = "idutente")
    @ManyToOne(optional = false)
    private Utente utente;

    public Studi() {
    }

    public Studi(Integer idstudi) {
        this.idstudi = idstudi;
    }

    public Studi(Integer idstudi, String istituto, String tipo, String voto, Date anno) {
        this.idstudi = idstudi;
        this.istituto = istituto;
        this.tipo = tipo;
        this.voto = voto;
        this.anno = anno;
    }

    public Integer getIdstudi() {
        return idstudi;
    }

    public void setIdstudi(Integer idstudi) {
        this.idstudi = idstudi;
    }

    public String getIstituto() {
        return istituto;
    }

    public void setIstituto(String istituto) {
        this.istituto = istituto;
    }

    public String getTipo() {
        return tipo;
    }

    public void setTipo(String tipo) {
        this.tipo = tipo;
    }

    public String getVoto() {
        return voto;
    }

    public void setVoto(String voto) {
        this.voto = voto;
    }

    public Date getAnno() {
        return anno;
    }

    public void setAnno(Date anno) {
        this.anno = anno;
    }

    public Utente getUtente() {
        return utente;
    }

    public void setUtente(Utente utente) {
        this.utente = utente;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idstudi != null ? idstudi.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Studi)) {
            return false;
        }
        Studi other = (Studi) object;
        if ((this.idstudi == null && other.idstudi != null) || (this.idstudi != null && !this.idstudi.equals(other.idstudi))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "multiface.promonet.jpa.Studi[ idstudi=" + idstudi + " ]";
    }
    
}
